<?php
if(!class_exists('WF')){
    require_once(dirname(__FILE__).'/../../init.php');
}
class WFErrorHandlerException extends Exception
{
    public static function errorHandlerCallback($errno, $errstr, $errfile, $errline){
        //throw new WFException($errstr, $errno);
        switch ($errno) {
            case E_NOTICE:
            case E_USER_NOTICE:
                $errors = "Notice";
            break;
            case E_WARNING:
            case E_USER_WARNING:
                $errors = "Warning";
            break;
            case E_ERROR:
            case E_USER_ERROR:
                $errors = "Fatal Error";
            break;
            default:
                $errors = "Unknown";
            break;
        }
        $strMsg = sprintf ("<br />\n<b>%s</b>: %s in <b>%s</b> on line <b>%d</b><br /><br />\n", $errors, $errstr, $errfile, $errline);
        switch ($errno) {
            case E_NOTICE:
            case E_USER_NOTICE:
            case E_WARNING:
            case E_USER_WARNING:
                myinfo_log($strMsg);
            break;
            case E_ERROR:
            case E_USER_ERROR:
            default:
                throw new WFException($strMsg, $errno);
            break;
        }
        return true;
    }
} 